package luoxuan.port.dao;

import java.util.List;

import org.springframework.orm.hibernate5.support.HibernateDaoSupport;

import luoxuan.port.entity.Port;

public class PortDao extends HibernateDaoSupport {

	public void save(Port port) {

		this.getHibernateTemplate().save(port);
	}

	public Port findById(int pId) {

		return this.getHibernateTemplate().get(Port.class, pId);
	}

	public void delete(Port existPort) {

		this.getHibernateTemplate().delete(existPort);
	}

	public void update(Port port) {

		this.getHibernateTemplate().update(port);
	}

	public List<Port> findAll() {
		
		String hql="from Port order by pId asc";
		List<Port> list=(List<Port>) this.getHibernateTemplate().find(hql);
		if(list!=null&&list.size()>0){
			return list;
		}
		return null;
	}
}
